package Thread;

/**
 * @description: Runnable_join
 * 合并线程 插队线程
 * join()
 * 被调用的线程会被堵塞
 * @date: 2019/12/19 20:57
 * @author: Vicuna
 */


public class Runnable_join implements Runnable {
    @Override
    public void run() {
    }

    public static void main(String[] args) throws InterruptedException {
       Thread t= new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("one--->"+i);
            }
        });
       t.start();
        for (int i=0;i<100;i++)
        {
            if(i==50){
                System.out.println("原线程会被堵塞");
                t.join();       // 该线程被堵塞 开始执行完 t
                System.out.println("-----------");
            }
            System.out.println("two--->"+i);
        }
    }
}
